package xiao.ze.demo.service.impl;


import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xiao.ze.demo.entity.User;
import xiao.ze.demo.mapper.UserMapper;
import xiao.ze.demo.service.UserService;

import javax.annotation.Resource;
import java.util.List;

/**
 * UserServiceImpl
 *
 * @author xiaoze
 * @date 2018/6/3
 *
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper ;


    @Override

    public  List<User>  loadUserByUserName(String userName){


        List<User> users  = null;
        User user  = userMapper.loadUserByUserName(userName);
        users =userMapper.select(user);
        return users;

    }

    @Override
    public void addUser(User user) {

        userMapper.insert(user);

    }

}